#ifndef __COMM_MSG_TRASH_BOX_OBST_STATE_H__
#define __COMM_MSG_TRASH_BOX_OBST_STATE_H__

#include "comm/comm_topic_name.h"
#include "comm/comm_base.h"

#include <std_msgs/Bool.h>
#include <ros/ros.h>
#include <iostream>
#include <list>
#include <vector>

using namespace std;

/**************************************************************************************
功能描述: 发布垃圾箱升降过程障碍状态消息
修改记录:
**************************************************************************************/
class TRASH_BOX_OBST_STATE_SENDER_C
{
public:
    TRASH_BOX_OBST_STATE_SENDER_C(ros::NodeHandle &nh)
    {
        publisher_ = nh.advertise<std_msgs::Bool>(TOPIC_NAME_TRASH_BOX_OBST_STATE, 1);
    }

    void Send(BOOL isClean)
    {
        std_msgs::Bool msg;
        msg.data = isClean;
        publisher_.publish(msg);
    }

private:
    ros::Publisher publisher_;
};

/**************************************************************************************
功能描述: 发布清扫状态消息
修改记录:
**************************************************************************************/
class TRASH_BOX_OBST_STATE_RECEIVER_C
{
public:
    TRASH_BOX_OBST_STATE_RECEIVER_C(ros::NodeHandle &nh)
    {
        exisitObst_  = true;
        receiver_ = nh.subscribe(TOPIC_NAME_TRASH_BOX_OBST_STATE, 1, &TRASH_BOX_OBST_STATE_RECEIVER_C::ReceiveMsgCallBack, this);
    }

    BOOL IsExisitObst()
    {
        return exisitObst_;
    }

private:
    void ReceiveMsgCallBack(const std_msgs::Bool::ConstPtr &pstMsg)
    {
        exisitObst_ = pstMsg->data;
    }

    ros::Subscriber  receiver_;
    BOOL exisitObst_;
};

#endif


